home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / qlib205.zip / QLIB.ZIP / H / CTYPE.H < prev    next >
C/C++ Source or Header  |  1997-01-20  |  2KB  |  65 lines

  1. #ifndef __CTYPE_H__
  2. #define __CTYPE_H__
  3.  
  4. #include <stddef.h>
  5.  
  6. extern byte toupper(byte);
  7. extern byte tolower(byte);
  8.  
  9. extern byte _ctype[ 257 ];
  10.  
  11. int isalnum (int __c);
  12. int isalpha (int __c);
  13. int iscntrl (int __c);
  14. int isdigit (int __c);
  15. int isgraph (int __c);
  16. int islower (int __c);
  17. int isprint (int __c);
  18. int ispunct (int __c);
  19. int isspace (int __c);
  20. int isupper (int __c);
  21. int isxdigit(int __c);
  22. int isascii (int __c);
  23.  
  24. #define _IS_SP     1           /* space */
  25. #define _IS_DIG    2           /* digit */
  26. #define _IS_UPP    4           /* upper case */
  27. #define _IS_LOW    8           /* lower case */
  28. #define _IS_HEX   16           /* [0..9] or [A-F] or [a-f] */
  29. #define _IS_CTL   32           /* control */
  30. #define _IS_PUN   64           /* punctuation */
  31. #define _IS_BLK  128           /* blank */
  32.  
  33. #define _IS_ALPHA    (_IS_UPP | _IS_LOW)
  34. #define _IS_ALNUM    (_IS_DIG | _IS_ALPHA)
  35. #define _IS_GRAPH    (_IS_ALNUM | _IS_HEX | _IS_PUN)
  36.  
  37. #define isalnum(c)   (_ctype[ (c)+1 ] & (_IS_ALNUM))
  38.  
  39. #define isalpha(c)   (_ctype[ (c)+1 ] & (_IS_ALPHA))
  40.  
  41. #define iscntrl(c)   (_ctype[ (c)+1 ] & (_IS_CTL))
  42.  
  43. #define isdigit(c)   (_ctype[ (c)+1 ] & (_IS_DIG))
  44.  
  45. #define isgraph(c)   (_ctype[ (c)+1 ] & (_IS_GRAPH))
  46.  
  47. #define islower(c)   (_ctype[ (c)+1 ] & (_IS_LOW))
  48.  
  49. #define isprint(c)   (_ctype[ (c)+1 ] & (_IS_GRAPH | _IS_BLK))
  50.  
  51. #define ispunct(c)   (_ctype[ (c)+1 ] & (_IS_PUN))
  52.  
  53. #define isspace(c)   (_ctype[ (c)+1 ] & (_IS_SP))
  54.  
  55. #define isupper(c)   (_ctype[ (c)+1 ] & (_IS_UPP))
  56.  
  57. #define isxdigit(c)  (_ctype[ (c)+1 ] & (_IS_HEX))
  58.  
  59. #define isascii(c)  ((unsigned)(c) < 128)
  60.  
  61. #define toascii(c)  ((c) & 0x7f)
  62.  
  63. #endif
  64.  
  65.